/* Watermark.js
 * 
 * Searches for all canvas with watermark id and then watermarks it
 * using with the website's logo via HTML5's canvas capabilties
 * 
 * This isn't general purposed yet:
 * Givens: 
 * img_loc = image location as parameter
 * Canvas with id="watermark"
 */

function watermark(img_loc){
	var canvas = document.getElementById("watermark");
	var context = canvas.getContext("2d");
	
	// load the image
	var pic = new Image();
	pic.src = img_loc;
		
	pic.onload = function(){
		canvas.width = pic.width;
		canvas.height = pic.height;
		
		/* draw the picture */ 
		context.drawImage(pic, 0, 0, canvas.width, canvas.height);
	
		/* Now draw the watermark */
		context.fillStyle = "#FFFFFF";
		context.textAlign = "right";
		context.textBaseline = "bottom";
		context.font = "bold 1em serif";
		context.fillText("Powered by HTML5 and CATS!", canvas.width - 5, canvas.height - 2);
	};
};

